<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:86:"D:\phpStudy\PHPTutorial\WWW\thinkphp\public/../application/admin\view\index\login.html";i:1532962083;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login</title>
</head>
<body>
<div style="text-align: center;margin:180px auto;padding: 0px;width: 500px;background: aquamarine">
    <table style="text-align: center" width="480px">
        <form method="post" action="" id="loginfrom" onsubmit="return false;">
        <tr>
            <td colspan="3">登录</td>
        </tr>
        <tr>
            <td width="20%">账号：</td>
            <td width="60%"><input id="username" type="text" name="username" value="" required></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input id="password" type="password" name="password" value="" required></td>
        </tr>
        <tr>
            <td>验证码：</td>
            <td><input id="captcha" type="text" name="captcha" required></td>
            <td>
                <img src="<?php echo captcha_src(); ?>" width="132" height="33" onclick="this.src='<?php echo captcha_src(); ?>'" alt="captcha" />
            </td>
        </tr>
        <tr>
            <td colspan="3"><input type="submit" id="login" value="登录"></td>
        </tr>
        </form>
    </table>
</div>
<script src="/static/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
    $(function(){
        $("#loginfrom").submit(function(){
            var username = $("#username").val();
            var password = $("#password").val();
            var captcha  = $("#captcha").val();
            if(username == ''){
                alert("用户名不能为空");
                return false;
            }
            if(password == ''){
                alert("密码不能为空");
                return false;
            }
            $.post("",{username:username,password:password,captcha:captcha},function(e){
                if(e.code==0){
                    alert(e.msg);
                    return false;
                }else{
                    alert(e.msg);
                    window.location.href="http://tp5.com/admin/index/index.html";
                    return;
                }
            },'json')
        })
    })
</script>
</body>
</html>